﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Df.Framework.Common;
using Df.Common.Model;

namespace Df.Business
{
    public interface IBaseBusiness<TEntity>
        where TEntity : BaseEntity
    {
        BaseDataContext DataContext { get; }

        IQueryable<TEntity> GetList(Expression<Func<TEntity, bool>> predicate);

        IQueryable<TEntity> GetList<TKey>(Expression<Func<TEntity, bool>> predicate,
                                          Expression<Func<TEntity, TKey>> orderBy);

        IQueryable<TEntity> GetList<TKey>(Expression<Func<TEntity, TKey>> orderBy);
        IQueryable<TEntity> GetList();

        OperationStatus Save();
        OperationStatus Create(TEntity entity);
        OperationStatus Delete(TEntity entity);
        OperationStatus Delete(int entityId);
        OperationStatus Update(TEntity entity);
        OperationStatus UpdateProperty(int entityId, string propertyName, object propertyValue);

        OperationStatus ExecuteStoreCommand(string cmdText, params object[] parameters);

    }
}
